package yu.liu.personal.app.myapplication.ui;

import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.view.View;

import yu.liu.personal.app.myapplication.R;
import yu.liu.personal.app.myapplication.utils.ResourceManager;

/**
 * Created by Administrator on 2016/9/24.
 */

public abstract class BaseUI extends FragmentActivity {

    protected Context resContext;
    protected ResourceManager resManager;
    protected View contentView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        resContext = getApplicationContext();
        resManager = ResourceManager.getManager(resContext);
        contentView = loadViews();
        setContentView(contentView);
        loadMembers();
        postSetup();


        FragmentManager fm = getFragmentManager();
        FragmentTransaction transaction = fm.beginTransaction();
        Fragment fragment = new Fragment();
        transaction.replace(R.id.id_content, fragment);
        transaction.commit();


    }

    protected abstract View loadViews();

    protected abstract void loadMembers();

    protected abstract void postSetup();

    protected abstract void updateViews();
}
